<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="/assets/perpageres/vant.min.css"/>
    <script src="/assets/perpageres/vue.min.js"></script>
	<script src="/assets/perpageres/vant.min.js"></script>
	<script src="/assets/perpageres/zepto.min.js"></script>
    <script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
    <title>#{$info.title}#</title>
    <style>
        body {
            padding: 0px;
        }

        .article-title {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .article-author {
            color: #999;
            margin-bottom: 10px;
        }

        .article-content {
            line-height: 1.5;
            font-size: 16px;
        }
        .article-content img{
            max-width: 100%;
        }

        .article-image {
            width: 100%;
            margin-bottom: 10px;
        }
        .fixed-button {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 50px;
            z-index: 999;
            background-color:#ed6101; /* 调整按钮背景色 */
            color: #ffffff; /* 调整按钮文字颜色 */
            text-align: center; /* 文字居中 */
            line-height: 50px;
        }
    </style>
    <script>
        !function(p){"use strict";!function(t){var s=window,e=document,i=p,c="".concat("https:"===e.location.protocol?"https://":"http://","sdk.51.la/js-sdk-pro.min.js"),n=e.createElement("script"),r=e.getElementsByTagName("script")[0];n.type="text/javascript",n.setAttribute("charset","UTF-8"),n.async=!0,n.src=c,n.id="LA_COLLECT",i.d=n;var o=function(){s.LA.ids.push(i)};s.LA?s.LA.ids&&o():(s.LA=p,s.LA.ids=[],o()),r.parentNode.insertBefore(n,r)}()}({id:"KBTYwQXPA0SNjMig",ck:"KBTYwQXPA0SNjMig"});
        </script>
</head>

<body>
    <div class="article">
        <!--
        <div class="article-title">#{$info.title}#</div>
        -->
        <div class="article-content">
            #{$info.details|htmlspecialchars_decode}#
        </div>
        <van-button class="fixed-button" type="primary" id="inviteBtn" round>  参与活动 </van-button>
    </div>

 <script>
$('#inviteBtn').on('click', function() {
    window.location.href = 'https://work.weixin.qq.com/kfid/kfc40341b633d7a8607';
});
<?php
    if($info['trigger_method']=='time'){
        
        echo "setTimeout(function() { kefu(); }, {$info['communication_duration']}*1000);";
    }else if($info['trigger_method']=='click'){
        echo '$("inviteBtn").show();';
    }else if($info['trigger_method']=='qrcode'){
        echo "$('#inviteBtn').show();setTimeout(function() { kefu(); }, {$info['communication_duration']}*1000);";
    }
?>

function kefu(){
    vant.Dialog.confirm({
        title: '客服邀请',
        message: '#{$promotion.question}#',
        confirmButtonText: '确定',
        cancelButtonText: '取消'
    })
    .then(() => {
        // 用户点击了确定按钮
        window.location.href = 'https://work.weixin.qq.com/kfid/kfc40341b633d7a8607';
    })
    .catch(() => {
        // 用户点击了取消按钮
    });
  }




wx.config({
  debug: false,  // 是否开启调试模式
  appId: '<?php echo $signPackage["appId"];?>',
    timestamp: <?php echo $signPackage["timestamp"];?>,
    nonceStr: '<?php echo $signPackage["nonceStr"];?>',
    signature: '<?php echo $signPackage["signature"];?>',
  jsApiList: ['updateAppMessageShareData','onMenuShareTimeline']  // 需要使用的接口列表
});

wx.ready(function () {
    wx.updateAppMessageShareData({
        title: '#{$info.title}#',
        desc: '#{$info.introduction}#',
        link: window.location.href,
        imgUrl: "<?php echo $info['thumb']?$info['thumb']:request()->domain().'/assets/logo.png'; ?>", 
        success: function () {
            // 设置成功后的回调函数
        }
    });

    wx.onMenuShareTimeline({
    title: '#{$info.title}#',  // 分享标题
    link: window.location.href,  // 分享链接
    desc: '#{$info.introduction}#',
    imgUrl: '#{$info.thumb}#',  // 分享图标
    success: function () {
        // 用户确认分享后执行的回调函数
    },
    cancel: function () {
        // 用户取消分享后执行的回调函数
    }
    });

});

</script>
<script src="/index.php/mobile/Promotion/statistics?pid=#{$promotion['id']}#"></script>
</body>
</html>
